using System.Data;
using Framework.Library;
using Framework.Library.Components;
using Framework.Module.Adsvertising.Lib.DataAccess;

namespace Framework.Module.Adsvertising.Lib.Distributor
{	
	public class AdvertiseDistributor
	{
		private static int GetExpire()
		{
            return AppEnv.GetTimeCacheExpire;
		}
		public static DataTable GetAvailables (int _positionID, int _paramID)
		{
			DataCaching dataCaching = new DataCaching();
			string _cacheKey = "Advertise.GetAvailables";		
			string _param = _positionID.ToString() + "_" + _paramID.ToString() + "Lang=" + AppEnv.GetLanguage();
			DataTable _retVal = (DataTable) dataCaching.GetHashCache(_cacheKey,_param);
			if (_retVal == null)
			{
				_retVal = AdvertiseDB.GetAvailables(_positionID,_paramID);
				dataCaching.SetHashCache(_cacheKey,_param,GetExpire(),_retVal);
			}
			return _retVal;
		}
	}
}
